
<template>
  <div>
    <div  v-if="visible" class="dialog-backdrop-yy-release-confirm">
       <!-- 遮罩层阻止点击别处 -->
  
      <div class="custom-dialog-yy-release-confirm" :style="customDialogFlex">


        <div class="dialog-container-yy-release-confirm">

          <!-- 上边图片 -->
          <div class="dialog-header-img-yy-release-confirm"></div>
          <div class="dialog-header-yy-release-confirm">
            <!-- 弹窗标题插槽或默认标题 -->
            <!-- 关闭按钮 -->
            <div class="shut-buttons-yy-release-confirm">
              <img src="@/assets/img/nav/关闭.png" @click="closeDialog" alt="关闭" class="button-icon-yy-release-confirm" />
            </div>
          </div>

          <div class="dialog-bg2-yy-release-confirm">
         <div class="text-container-yy-release-confirm">
          <h2>请确认是否发布</h2>
         </div>

         <div class="button-container-yy-release-confirm">
            <button class="button-confirm-yy-release-confirm" @click="confirmDialog">确认</button>

            <button class="button-cancel-yy-release-confirm" @click="closeDialog">取消</button>
         </div>
        </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    visible: {
      type: Boolean,
      required: true,
    },
    title: {
      type: String,
      default: "默认标题", // 弹窗默认标题
    },
    closeButtonText: {
      type: String,
      default: "关闭", // 关闭按钮默认文本
    },
    width: {
      type: String,
      default: '600px'
    },
    height: {
      type: String,
      default: '300px'
    }
  },
  computed: {
    // 动态生成弹窗样式
    customDialogFlex() {
      return {
        width: this.width,
        height: this.height
      };
    }
  },

  methods: {
    closeDialog() {
      this.$emit("update:visible", false); // 通知父组件关闭弹窗
    },
    confirmDialog() {
      // 需要写提交的逻辑


      this.$emit("update:visible", false); // 通知父组件关闭弹窗
    }
  },
};
</script>

<style scoped>
/* 弹窗背景 */
.custom-dialog-yy-release-confirm {
  position: absolute;
  top: 50%;
  /* 顶部居中 */
  left: 50%;
  /* 左侧居中 */
  transform: translate(-50%, -50%);
  /* 向上、向左偏移自身宽高的一半 */
  /* position: fixed;
    top: 0;
    left: 0; */
  /* width: 100vw;
    height: 100vh; */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  /* background-color: white; */
}

/* 弹窗背景遮罩 */
.dialog-backdrop-yy-release-confirm {
  z-index:2000;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  /* 半透明黑色背景 */
}

/* 弹窗容器 */
.dialog-container-yy-release-confirm {
  position: relative;
  width: 80%;
  /* 弹窗宽度 */
  height: 80%;
  /* background-image: url("@/assets/img/test/bg_border.png"); */
  background-image: url('@/assets/img/module1/dialog_bg.png');
  /* 背景图片 */
  background-size: cover;
  padding: 20px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  /* 阴影效果 */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dialog-header-img-yy-release-confirm{
  position:absolute;
  background: url('@/assets/img/module1/dialog_top.png');
  background-size: 100% 100%;
  top: 0%;
  left: 0%;
  width: 100%;
  height: 17%;
  /* background-color: white; */

}

.dialog-bg2-yy-release-confirm{
  position: absolute;
  background: url('@/assets/img/module1/dialog_bg2.png');
  background-size: 100% 100%;
  /* background-color: white; */
  top: 20%;
  left: 6%;
  width: 88%;
  height: 73%;

}


/* 弹窗顶部标题和按钮 */
.dialog-header-yy-release-confirm {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.text-container-yy-release-confirm{
  position:absolute;
  top: 30%;
  /* 顶部居中 */
  left: 50%;
  /* 左侧居中 */
  transform: translate(-50%, -50%);

}

.button-container-yy-release-confirm{
  position:absolute;
  top: 60%;
  /* 顶部居中 */
  left: 20%;
  width: 60%;
  height:20%;
  /* background-color: white; */
  
}

.button-confirm-yy-release-confirm{
  background-image: url('@/assets/img/module1/button-tijiao.png'); 
  position: absolute;
  background-size: 100% 100%;
  /* 背景图片覆盖按钮大小 */
  background-repeat: no-repeat;
  background-color: transparent;
  color: transparent;
  left: 0%;
  top: 0%;
  height: 100%;
  width: 32%;
  border: none;
  cursor: pointer;
  color: white;
  font-size: 24px;
  text-align: center;
  line-height: 40px
}

.button-cancel-yy-release-confirm{
  background-image: url('@/assets/img/module1/button-bohui.png');
  position: absolute;
  background-size: 100% 100%;
  /* 背景图片覆盖按钮大小 */
  background-repeat: no-repeat;
  background-color: transparent;
  color: transparent;
  right: 0%;
  top: 0%;
  height: 100%;
  width: 32%;
  border: none;
  cursor: pointer;
  color: white;
  font-size: 24px;
  text-align: center;
  line-height: 40px
}

.dialog-title-yy-release-confirm {
  font-size: 1.5rem;
  margin: 0;
}



.shut-buttons-yy-release-confirm {
  position: absolute;
  top: 2%;
  right: 2%
}

.button-icon-yy-release-confirm {
  width: 40px;
  height: 40px;
  cursor: pointer;
}




</style>